#line 1 "source/user_solutions.c"
#line 1 "source/user_solutions.c"

#line 11 "source/user_solutions.c"
 


#line 24 "source/user_solutions.c"
 

 
#line 1 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"

#line 3 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"

#line 5 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 7 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 9 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 11 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 13 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 15 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 17 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 19 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 21 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 23 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 25 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 27 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 29 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 31 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 33 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 35 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 37 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 39 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 41 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 43 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 45 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 47 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 49 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 51 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 53 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 55 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 57 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 59 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 61 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 63 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 65 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 67 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 69 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 71 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 73 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 75 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 77 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 79 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 81 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 83 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 85 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 87 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 89 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 91 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 93 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 95 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 97 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 99 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 101 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 103 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 105 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 107 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 109 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 111 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 113 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 115 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 117 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 119 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 121 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 123 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 125 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 127 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 129 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 131 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 133 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 135 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 137 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 139 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 141 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 143 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 145 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 147 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 149 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 151 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 153 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 155 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 157 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 159 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 161 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 163 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 165 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 167 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 169 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 171 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 173 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 175 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 177 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 179 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 181 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 183 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 185 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 187 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 189 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 191 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 193 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 195 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 197 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 199 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 201 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 203 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 205 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 207 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 209 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 211 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 213 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 1 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"

#line 5 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
 


#line 9 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"

extern volatile near unsigned char       SPPDATA;
extern volatile near unsigned char       SPPCFG;
extern volatile near union {
  struct {
    unsigned WS:4;
    unsigned CLK1EN:1;
    unsigned CSEN:1;
    unsigned CLKCFG:2;
  };
  struct {
    unsigned WS0:1;
    unsigned WS1:1;
    unsigned WS2:1;
    unsigned WS3:1;
    unsigned :2;
    unsigned CLKCFG0:1;
    unsigned CLKCFG1:1;
  };
} SPPCFGbits;
extern volatile near unsigned char       SPPEPS;
extern volatile near union {
  struct {
    unsigned ADDR:4;
    unsigned SPPBUSY:1;
    unsigned :1;
    unsigned WRSPP:1;
    unsigned RDSPP:1;
  };
  struct {
    unsigned ADDR0:1;
    unsigned ADDR1:1;
    unsigned ADDR2:1;
    unsigned ADDR3:1;
  };
} SPPEPSbits;
extern volatile near unsigned char       SPPCON;
extern volatile near struct {
  unsigned SPPEN:1;
  unsigned SPPOWN:1;
} SPPCONbits;
extern volatile near unsigned            UFRM;
extern volatile near unsigned char       UFRML;
extern volatile near union {
  struct {
    unsigned FRM:8;
  };
  struct {
    unsigned FRM0:1;
    unsigned FRM1:1;
    unsigned FRM2:1;
    unsigned FRM3:1;
    unsigned FRM4:1;
    unsigned FRM5:1;
    unsigned FRM6:1;
    unsigned FRM7:1;
  };
} UFRMLbits;
extern volatile near unsigned char       UFRMH;
extern volatile near union {
  struct {
    unsigned FRM:3;
  };
  struct {
    unsigned FRM8:1;
    unsigned FRM9:1;
    unsigned FRM10:1;
  };
} UFRMHbits;
extern volatile near unsigned char       UIR;
extern volatile near struct {
  unsigned URSTIF:1;
  unsigned UERRIF:1;
  unsigned ACTVIF:1;
  unsigned TRNIF:1;
  unsigned IDLEIF:1;
  unsigned STALLIF:1;
  unsigned SOFIF:1;
} UIRbits;
extern volatile near unsigned char       UIE;
extern volatile near struct {
  unsigned URSTIE:1;
  unsigned UERRIE:1;
  unsigned ACTVIE:1;
  unsigned TRNIE:1;
  unsigned IDLEIE:1;
  unsigned STALLIE:1;
  unsigned SOFIE:1;
} UIEbits;
extern volatile near unsigned char       UEIR;
extern volatile near struct {
  unsigned PIDEF:1;
  unsigned CRC5EF:1;
  unsigned CRC16EF:1;
  unsigned DFN8EF:1;
  unsigned BTOEF:1;
  unsigned :2;
  unsigned BTSEF:1;
} UEIRbits;
extern volatile near unsigned char       UEIE;
extern volatile near struct {
  unsigned PIDEE:1;
  unsigned CRC5EE:1;
  unsigned CRC16EE:1;
  unsigned DFN8EE:1;
  unsigned BTOEE:1;
  unsigned :2;
  unsigned BTSEE:1;
} UEIEbits;
extern volatile near unsigned char       USTAT;
extern volatile near union {
  struct {
    unsigned :1;
    unsigned PPBI:1;
    unsigned DIR:1;
    unsigned ENDP:4;
  };
  struct {
    unsigned :3;
    unsigned ENDP0:1;
    unsigned ENDP1:1;
    unsigned ENDP2:1;
    unsigned ENDP3:1;
  };
} USTATbits;
extern volatile near unsigned char       UCON;
extern volatile near struct {
  unsigned :1;
  unsigned SUSPND:1;
  unsigned RESUME:1;
  unsigned USBEN:1;
  unsigned PKTDIS:1;
  unsigned SE0:1;
  unsigned PPBRST:1;
} UCONbits;
extern volatile near unsigned char       UADDR;
extern volatile near union {
  struct {
    unsigned ADDR:7;
  };
  struct {
    unsigned ADDR0:1;
    unsigned ADDR1:1;
    unsigned ADDR2:1;
    unsigned ADDR3:1;
    unsigned ADDR4:1;
    unsigned ADDR5:1;
    unsigned ADDR6:1;
  };
} UADDRbits;
extern volatile near unsigned char       UCFG;
extern volatile near union {
  struct {
    unsigned PPB:2;
    unsigned FSEN:1;
    unsigned UTRDIS:1;
    unsigned UPUEN:1;
    unsigned :1;
    unsigned UOEMON:1;
    unsigned UTEYE:1;
  };
  struct {
    unsigned PPB0:1;
    unsigned PPB1:1;
  };
} UCFGbits;
extern volatile near unsigned char       UEP0;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP0bits;
extern volatile near unsigned char       UEP1;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP1bits;
extern volatile near unsigned char       UEP2;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP2bits;
extern volatile near unsigned char       UEP3;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP3bits;
extern volatile near unsigned char       UEP4;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP4bits;
extern volatile near unsigned char       UEP5;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP5bits;
extern volatile near unsigned char       UEP6;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP6bits;
extern volatile near unsigned char       UEP7;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP7bits;
extern volatile near unsigned char       UEP8;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP8bits;
extern volatile near unsigned char       UEP9;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP9bits;
extern volatile near unsigned char       UEP10;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP10bits;
extern volatile near unsigned char       UEP11;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP11bits;
extern volatile near unsigned char       UEP12;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP12bits;
extern volatile near unsigned char       UEP13;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP13bits;
extern volatile near unsigned char       UEP14;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP14bits;
extern volatile near unsigned char       UEP15;
extern volatile near struct {
  unsigned EPSTALL:1;
  unsigned EPINEN:1;
  unsigned EPOUTEN:1;
  unsigned EPCONDIS:1;
  unsigned EPHSHK:1;
} UEP15bits;
extern volatile near unsigned char       PORTA;
extern volatile near union {
  struct {
    unsigned RA0:1;
    unsigned RA1:1;
    unsigned RA2:1;
    unsigned RA3:1;
    unsigned RA4:1;
    unsigned RA5:1;
    unsigned RA6:1;
  };
  struct {
    unsigned AN0:1;
    unsigned AN1:1;
    unsigned AN2:1;
    unsigned AN3:1;
    unsigned T0CKI:1;
    unsigned AN4:1;
    unsigned OSC2:1;
  };
  struct {
    unsigned :2;
    unsigned VREFM:1;
    unsigned VREFP:1;
    unsigned :1;
    unsigned LVDIN:1;
  };
  struct {
    unsigned :5;
    unsigned HLVDIN:1;
  };
} PORTAbits;
extern volatile near unsigned char       PORTB;
extern volatile near union {
  struct {
    unsigned RB0:1;
    unsigned RB1:1;
    unsigned RB2:1;
    unsigned RB3:1;
    unsigned RB4:1;
    unsigned RB5:1;
    unsigned RB6:1;
    unsigned RB7:1;
  };
  struct {
    unsigned INT0:1;
    unsigned INT1:1;
    unsigned INT2:1;
    unsigned :2;
    unsigned PGM:1;
    unsigned PGC:1;
    unsigned PGD:1;
  };
} PORTBbits;
extern volatile near unsigned char       PORTC;
extern volatile near union {
  struct {
    unsigned RC0:1;
    unsigned RC1:1;
    unsigned RC2:1;
    unsigned :1;
    unsigned RC4:1;
    unsigned RC5:1;
    unsigned RC6:1;
    unsigned RC7:1;
  };
  struct {
    unsigned T1OSO:1;
    unsigned T1OSI:1;
    unsigned CCP1:1;
    unsigned :3;
    unsigned TX:1;
    unsigned RX:1;
  };
  struct {
    unsigned T13CKI:1;
    unsigned :1;
    unsigned P1A:1;
    unsigned :3;
    unsigned CK:1;
    unsigned DT:1;
  };
} PORTCbits;
extern volatile near unsigned char       PORTD;
extern volatile near union {
  struct {
    unsigned RD0:1;
    unsigned RD1:1;
    unsigned RD2:1;
    unsigned RD3:1;
    unsigned RD4:1;
    unsigned RD5:1;
    unsigned RD6:1;
    unsigned RD7:1;
  };
  struct {
    unsigned SPP0:1;
    unsigned SPP1:1;
    unsigned SPP2:1;
    unsigned SPP3:1;
    unsigned SPP4:1;
    unsigned SPP5:1;
    unsigned SPP6:1;
    unsigned SPP7:1;
  };
} PORTDbits;
extern volatile near unsigned char       PORTE;
extern volatile near union {
  struct {
    unsigned RE0:1;
    unsigned RE1:1;
    unsigned RE2:1;
    unsigned RE3:1;
    unsigned :3;
    unsigned RDPU:1;
  };
  struct {
    unsigned CK1SPP:1;
    unsigned CK2SPP:1;
    unsigned OESPP:1;
  };
} PORTEbits;
extern volatile near unsigned char       LATA;
extern volatile near struct {
  unsigned LATA0:1;
  unsigned LATA1:1;
  unsigned LATA2:1;
  unsigned LATA3:1;
  unsigned LATA4:1;
  unsigned LATA5:1;
  unsigned LATA6:1;
} LATAbits;
extern volatile near unsigned char       LATB;
extern volatile near struct {
  unsigned LATB0:1;
  unsigned LATB1:1;
  unsigned LATB2:1;
  unsigned LATB3:1;
  unsigned LATB4:1;
  unsigned LATB5:1;
  unsigned LATB6:1;
  unsigned LATB7:1;
} LATBbits;
extern volatile near unsigned char       LATC;
extern volatile near struct {
  unsigned LATC0:1;
  unsigned LATC1:1;
  unsigned LATC2:1;
  unsigned :3;
  unsigned LATC6:1;
  unsigned LATC7:1;
} LATCbits;
extern volatile near unsigned char       LATD;
extern volatile near struct {
  unsigned LATD0:1;
  unsigned LATD1:1;
  unsigned LATD2:1;
  unsigned LATD3:1;
  unsigned LATD4:1;
  unsigned LATD5:1;
  unsigned LATD6:1;
  unsigned LATD7:1;
} LATDbits;
extern volatile near unsigned char       LATE;
extern volatile near struct {
  unsigned LATE0:1;
  unsigned LATE1:1;
  unsigned LATE2:1;
} LATEbits;
extern volatile near unsigned char       DDRA;
extern volatile near union {
  struct {
    unsigned TRISA0:1;
    unsigned TRISA1:1;
    unsigned TRISA2:1;
    unsigned TRISA3:1;
    unsigned TRISA4:1;
    unsigned TRISA5:1;
    unsigned TRISA6:1;
  };
  struct {
    unsigned RA0:1;
    unsigned RA1:1;
    unsigned RA2:1;
    unsigned RA3:1;
    unsigned RA4:1;
    unsigned RA5:1;
    unsigned RA6:1;
  };
} DDRAbits;
extern volatile near unsigned char       TRISA;
extern volatile near union {
  struct {
    unsigned TRISA0:1;
    unsigned TRISA1:1;
    unsigned TRISA2:1;
    unsigned TRISA3:1;
    unsigned TRISA4:1;
    unsigned TRISA5:1;
    unsigned TRISA6:1;
  };
  struct {
    unsigned RA0:1;
    unsigned RA1:1;
    unsigned RA2:1;
    unsigned RA3:1;
    unsigned RA4:1;
    unsigned RA5:1;
    unsigned RA6:1;
  };
} TRISAbits;
extern volatile near unsigned char       DDRB;
extern volatile near union {
  struct {
    unsigned TRISB0:1;
    unsigned TRISB1:1;
    unsigned TRISB2:1;
    unsigned TRISB3:1;
    unsigned TRISB4:1;
    unsigned TRISB5:1;
    unsigned TRISB6:1;
    unsigned TRISB7:1;
  };
  struct {
    unsigned RB0:1;
    unsigned RB1:1;
    unsigned RB2:1;
    unsigned RB3:1;
    unsigned RB4:1;
    unsigned RB5:1;
    unsigned RB6:1;
    unsigned RB7:1;
  };
} DDRBbits;
extern volatile near unsigned char       TRISB;
extern volatile near union {
  struct {
    unsigned TRISB0:1;
    unsigned TRISB1:1;
    unsigned TRISB2:1;
    unsigned TRISB3:1;
    unsigned TRISB4:1;
    unsigned TRISB5:1;
    unsigned TRISB6:1;
    unsigned TRISB7:1;
  };
  struct {
    unsigned RB0:1;
    unsigned RB1:1;
    unsigned RB2:1;
    unsigned RB3:1;
    unsigned RB4:1;
    unsigned RB5:1;
    unsigned RB6:1;
    unsigned RB7:1;
  };
} TRISBbits;
extern volatile near unsigned char       DDRC;
extern volatile near union {
  struct {
    unsigned TRISC0:1;
    unsigned TRISC1:1;
    unsigned TRISC2:1;
    unsigned :3;
    unsigned TRISC6:1;
    unsigned TRISC7:1;
  };
  struct {
    unsigned RC0:1;
    unsigned RC1:1;
    unsigned RC2:1;
    unsigned :3;
    unsigned RC6:1;
    unsigned RC7:1;
  };
} DDRCbits;
extern volatile near unsigned char       TRISC;
extern volatile near union {
  struct {
    unsigned TRISC0:1;
    unsigned TRISC1:1;
    unsigned TRISC2:1;
    unsigned :3;
    unsigned TRISC6:1;
    unsigned TRISC7:1;
  };
  struct {
    unsigned RC0:1;
    unsigned RC1:1;
    unsigned RC2:1;
    unsigned :3;
    unsigned RC6:1;
    unsigned RC7:1;
  };
} TRISCbits;
extern volatile near unsigned char       DDRD;
extern volatile near union {
  struct {
    unsigned TRISD0:1;
    unsigned TRISD1:1;
    unsigned TRISD2:1;
    unsigned TRISD3:1;
    unsigned TRISD4:1;
    unsigned TRISD5:1;
    unsigned TRISD6:1;
    unsigned TRISD7:1;
  };
  struct {
    unsigned RD0:1;
    unsigned RD1:1;
    unsigned RD2:1;
    unsigned RD3:1;
    unsigned RD4:1;
    unsigned RD5:1;
    unsigned RD6:1;
    unsigned RD7:1;
  };
} DDRDbits;
extern volatile near unsigned char       TRISD;
extern volatile near union {
  struct {
    unsigned TRISD0:1;
    unsigned TRISD1:1;
    unsigned TRISD2:1;
    unsigned TRISD3:1;
    unsigned TRISD4:1;
    unsigned TRISD5:1;
    unsigned TRISD6:1;
    unsigned TRISD7:1;
  };
  struct {
    unsigned RD0:1;
    unsigned RD1:1;
    unsigned RD2:1;
    unsigned RD3:1;
    unsigned RD4:1;
    unsigned RD5:1;
    unsigned RD6:1;
    unsigned RD7:1;
  };
} TRISDbits;
extern volatile near unsigned char       DDRE;
extern volatile near union {
  struct {
    unsigned TRISE0:1;
    unsigned TRISE1:1;
    unsigned TRISE2:1;
  };
  struct {
    unsigned RE0:1;
    unsigned RE1:1;
    unsigned RE2:1;
  };
} DDREbits;
extern volatile near unsigned char       TRISE;
extern volatile near union {
  struct {
    unsigned TRISE0:1;
    unsigned TRISE1:1;
    unsigned TRISE2:1;
  };
  struct {
    unsigned RE0:1;
    unsigned RE1:1;
    unsigned RE2:1;
  };
} TRISEbits;
extern volatile near unsigned char       OSCTUNE;
extern volatile near union {
  struct {
    unsigned TUN:5;
    unsigned :2;
    unsigned INTSRC:1;
  };
  struct {
    unsigned TUN0:1;
    unsigned TUN1:1;
    unsigned TUN2:1;
    unsigned TUN3:1;
    unsigned TUN4:1;
  };
} OSCTUNEbits;
extern volatile near unsigned char       PIE1;
extern volatile near struct {
  unsigned TMR1IE:1;
  unsigned TMR2IE:1;
  unsigned CCP1IE:1;
  unsigned SSPIE:1;
  unsigned TXIE:1;
  unsigned RCIE:1;
  unsigned ADIE:1;
  unsigned SPPIE:1;
} PIE1bits;
extern volatile near unsigned char       PIR1;
extern volatile near struct {
  unsigned TMR1IF:1;
  unsigned TMR2IF:1;
  unsigned CCP1IF:1;
  unsigned SSPIF:1;
  unsigned TXIF:1;
  unsigned RCIF:1;
  unsigned ADIF:1;
  unsigned SPPIF:1;
} PIR1bits;
extern volatile near unsigned char       IPR1;
extern volatile near struct {
  unsigned TMR1IP:1;
  unsigned TMR2IP:1;
  unsigned CCP1IP:1;
  unsigned SSPIP:1;
  unsigned TXIP:1;
  unsigned RCIP:1;
  unsigned ADIP:1;
  unsigned SPPIP:1;
} IPR1bits;
extern volatile near unsigned char       PIE2;
extern volatile near union {
  struct {
    unsigned CCP2IE:1;
    unsigned TMR3IE:1;
    unsigned HLVDIE:1;
    unsigned BCLIE:1;
    unsigned EEIE:1;
    unsigned USBIE:1;
    unsigned CMIE:1;
    unsigned OSCFIE:1;
  };
  struct {
    unsigned :2;
    unsigned LVDIE:1;
  };
} PIE2bits;
extern volatile near unsigned char       PIR2;
extern volatile near union {
  struct {
    unsigned CCP2IF:1;
    unsigned TMR3IF:1;
    unsigned HLVDIF:1;
    unsigned BCLIF:1;
    unsigned EEIF:1;
    unsigned USBIF:1;
    unsigned CMIF:1;
    unsigned OSCFIF:1;
  };
  struct {
    unsigned :2;
    unsigned LVDIF:1;
  };
} PIR2bits;
extern volatile near unsigned char       IPR2;
extern volatile near union {
  struct {
    unsigned CCP2IP:1;
    unsigned TMR3IP:1;
    unsigned HLVDIP:1;
    unsigned BCLIP:1;
    unsigned EEIP:1;
    unsigned USBIP:1;
    unsigned CMIP:1;
    unsigned OSCFIP:1;
  };
  struct {
    unsigned :2;
    unsigned LVDIP:1;
  };
} IPR2bits;
extern volatile near unsigned char       EECON1;
extern volatile near struct {
  unsigned RD:1;
  unsigned WR:1;
  unsigned WREN:1;
  unsigned WRERR:1;
  unsigned FREE:1;
  unsigned :1;
  unsigned CFGS:1;
  unsigned EEPGD:1;
} EECON1bits;
extern volatile near unsigned char       EECON2;
extern volatile near unsigned char       EEDATA;
extern volatile near unsigned char       EEADR;
extern volatile near unsigned char       RCSTA;
extern volatile near union {
  struct {
    unsigned RX9D:1;
    unsigned OERR:1;
    unsigned FERR:1;
    unsigned ADDEN:1;
    unsigned CREN:1;
    unsigned SREN:1;
    unsigned RX9:1;
    unsigned SPEN:1;
  };
  struct {
    unsigned :3;
    unsigned ADEN:1;
  };
} RCSTAbits;
extern volatile near unsigned char       TXSTA;
extern volatile near struct {
  unsigned TX9D:1;
  unsigned TRMT:1;
  unsigned BRGH:1;
  unsigned SENDB:1;
  unsigned SYNC:1;
  unsigned TXEN:1;
  unsigned TX9:1;
  unsigned CSRC:1;
} TXSTAbits;
extern volatile near unsigned char       TXREG;
extern volatile near unsigned char       RCREG;
extern volatile near unsigned char       SPBRG;
extern volatile near unsigned char       SPBRGH;
extern volatile near unsigned char       T3CON;
extern volatile near union {
  struct {
    unsigned TMR3ON:1;
    unsigned TMR3CS:1;
    unsigned NOT_T3SYNC:1;
    unsigned T3CCP1:1;
    unsigned T3CKPS:2;
    unsigned T3CCP2:1;
    unsigned RD16:1;
  };
  struct {
    unsigned :2;
    unsigned T3SYNC:1;
    unsigned :1;
    unsigned T3CKPS0:1;
    unsigned T3CKPS1:1;
  };
  struct {
    unsigned :2;
    unsigned T3NSYNC:1;
  };
} T3CONbits;
extern volatile near unsigned char       TMR3L;
extern volatile near unsigned char       TMR3H;
extern volatile near unsigned char       CMCON;
extern volatile near union {
  struct {
    unsigned CM:3;
    unsigned CIS:1;
    unsigned C1INV:1;
    unsigned C2INV:1;
    unsigned C1OUT:1;
    unsigned C2OUT:1;
  };
  struct {
    unsigned CM0:1;
    unsigned CM1:1;
    unsigned CM2:1;
  };
} CMCONbits;
extern volatile near unsigned char       CVRCON;
extern volatile near union {
  struct {
    unsigned CVR:4;
    unsigned CVRSS:1;
    unsigned CVRR:1;
    unsigned CVROE:1;
    unsigned CVREN:1;
  };
  struct {
    unsigned CVR0:1;
    unsigned CVR1:1;
    unsigned CVR2:1;
    unsigned CVR3:1;
    unsigned CVREF:1;
  };
} CVRCONbits;
extern volatile near unsigned char       CCP1AS;
extern volatile near union {
  struct {
    unsigned PSSBD:2;
    unsigned PSSAC:2;
    unsigned ECCPAS:3;
    unsigned ECCPASE:1;
  };
  struct {
    unsigned PSSBD0:1;
    unsigned PSSBD1:1;
    unsigned PSSAC0:1;
    unsigned PSSAC1:1;
    unsigned ECCPAS0:1;
    unsigned ECCPAS1:1;
    unsigned ECCPAS2:1;
  };
} CCP1ASbits;
extern volatile near unsigned char       ECCP1AS;
extern volatile near union {
  struct {
    unsigned PSSBD:2;
    unsigned PSSAC:2;
    unsigned ECCPAS:3;
    unsigned ECCPASE:1;
  };
  struct {
    unsigned PSSBD0:1;
    unsigned PSSBD1:1;
    unsigned PSSAC0:1;
    unsigned PSSAC1:1;
    unsigned ECCPAS0:1;
    unsigned ECCPAS1:1;
    unsigned ECCPAS2:1;
  };
} ECCP1ASbits;
extern volatile near unsigned char       CCP1DEL;
extern volatile near union {
  struct {
    unsigned PDC:7;
    unsigned PRSEN:1;
  };
  struct {
    unsigned PDC0:1;
    unsigned PDC1:1;
    unsigned PDC2:1;
    unsigned PDC3:1;
    unsigned PDC4:1;
    unsigned PDC5:1;
    unsigned PDC6:1;
  };
} CCP1DELbits;
extern volatile near unsigned char       ECCP1DEL;
extern volatile near union {
  struct {
    unsigned PDC:7;
    unsigned PRSEN:1;
  };
  struct {
    unsigned PDC0:1;
    unsigned PDC1:1;
    unsigned PDC2:1;
    unsigned PDC3:1;
    unsigned PDC4:1;
    unsigned PDC5:1;
    unsigned PDC6:1;
  };
} ECCP1DELbits;
extern volatile near unsigned char       BAUDCON;
extern volatile near union {
  struct {
    unsigned ABDEN:1;
    unsigned WUE:1;
    unsigned :1;
    unsigned BRG16:1;
    unsigned TXCKP:1;
    unsigned RXDTP:1;
    unsigned RCIDL:1;
    unsigned ABDOVF:1;
  };
  struct {
    unsigned :4;
    unsigned SCKP:1;
    unsigned :1;
    unsigned RCMT:1;
  };
} BAUDCONbits;
extern volatile near unsigned char       BAUDCTL;
extern volatile near union {
  struct {
    unsigned ABDEN:1;
    unsigned WUE:1;
    unsigned :1;
    unsigned BRG16:1;
    unsigned TXCKP:1;
    unsigned RXDTP:1;
    unsigned RCIDL:1;
    unsigned ABDOVF:1;
  };
  struct {
    unsigned :4;
    unsigned SCKP:1;
    unsigned :1;
    unsigned RCMT:1;
  };
} BAUDCTLbits;
extern volatile near unsigned char       CCP2CON;
extern volatile near union {
  struct {
    unsigned CCP2M:4;
    unsigned DC2B:2;
  };
  struct {
    unsigned CCP2M0:1;
    unsigned CCP2M1:1;
    unsigned CCP2M2:1;
    unsigned CCP2M3:1;
    unsigned DC2B0:1;
    unsigned DC2B1:1;
  };
} CCP2CONbits;
extern volatile near unsigned            CCPR2;
extern volatile near unsigned char       CCPR2L;
extern volatile near unsigned char       CCPR2H;
extern volatile near unsigned char       CCP1CON;
extern volatile near union {
  struct {
    unsigned CCP1M:4;
    unsigned DC1B:2;
    unsigned P1M:2;
  };
  struct {
    unsigned CCP1M0:1;
    unsigned CCP1M1:1;
    unsigned CCP1M2:1;
    unsigned CCP1M3:1;
    unsigned DC1B0:1;
    unsigned DC1B1:1;
    unsigned P1M0:1;
    unsigned P1M1:1;
  };
} CCP1CONbits;
extern volatile near unsigned char       ECCP1CON;
extern volatile near union {
  struct {
    unsigned CCP1M:4;
    unsigned DC1B:2;
    unsigned P1M:2;
  };
  struct {
    unsigned CCP1M0:1;
    unsigned CCP1M1:1;
    unsigned CCP1M2:1;
    unsigned CCP1M3:1;
    unsigned DC1B0:1;
    unsigned DC1B1:1;
    unsigned P1M0:1;
    unsigned P1M1:1;
  };
} ECCP1CONbits;
extern volatile near unsigned            CCPR1;
extern volatile near unsigned char       CCPR1L;
extern volatile near unsigned char       CCPR1H;
extern volatile near unsigned char       ADCON2;
extern volatile near union {
  struct {
    unsigned ADCS:3;
    unsigned ACQT:3;
    unsigned :1;
    unsigned ADFM:1;
  };
  struct {
    unsigned ADCS0:1;
    unsigned ADCS1:1;
    unsigned ADCS2:1;
    unsigned ACQT0:1;
    unsigned ACQT1:1;
    unsigned ACQT2:1;
  };
} ADCON2bits;
extern volatile near unsigned char       ADCON1;
extern volatile near union {
  struct {
    unsigned PCFG:4;
    unsigned VCFG:2;
  };
  struct {
    unsigned PCFG0:1;
    unsigned PCFG1:1;
    unsigned PCFG2:1;
    unsigned PCFG3:1;
    unsigned VCFG0:1;
    unsigned VCFG1:1;
  };
} ADCON1bits;
extern volatile near unsigned char       ADCON0;
extern volatile near union {
  struct {
    unsigned ADON:1;
    unsigned GO_NOT_DONE:1;
    unsigned CHS:4;
  };
  struct {
    unsigned :1;
    unsigned GO_DONE:1;
    unsigned CHS0:1;
    unsigned CHS1:1;
    unsigned CHS2:1;
    unsigned CHS3:1;
  };
  struct {
    unsigned :1;
    unsigned DONE:1;
  };
  struct {
    unsigned :1;
    unsigned GO:1;
  };
  struct {
    unsigned :1;
    unsigned NOT_DONE:1;
  };
} ADCON0bits;
extern volatile near unsigned            ADRES;
extern volatile near unsigned char       ADRESL;
extern volatile near unsigned char       ADRESH;
extern volatile near unsigned char       SSPCON2;
extern volatile near struct {
  unsigned SEN:1;
  unsigned RSEN:1;
  unsigned PEN:1;
  unsigned RCEN:1;
  unsigned ACKEN:1;
  unsigned ACKDT:1;
  unsigned ACKSTAT:1;
  unsigned GCEN:1;
} SSPCON2bits;
extern volatile near unsigned char       SSPCON1;
extern volatile near union {
  struct {
    unsigned SSPM:4;
    unsigned CKP:1;
    unsigned SSPEN:1;
    unsigned SSPOV:1;
    unsigned WCOL:1;
  };
  struct {
    unsigned SSPM0:1;
    unsigned SSPM1:1;
    unsigned SSPM2:1;
    unsigned SSPM3:1;
  };
} SSPCON1bits;
extern volatile near unsigned char       SSPSTAT;
extern volatile near union {
  struct {
    unsigned BF:1;
    unsigned UA:1;
    unsigned R_NOT_W:1;
    unsigned S:1;
    unsigned P:1;
    unsigned D_NOT_A:1;
    unsigned CKE:1;
    unsigned SMP:1;
  };
  struct {
    unsigned :2;
    unsigned R_W:1;
    unsigned :2;
    unsigned D_A:1;
  };
  struct {
    unsigned :2;
    unsigned I2C_READ:1;
    unsigned I2C_START:1;
    unsigned I2C_STOP:1;
    unsigned I2C_DAT:1;
  };
  struct {
    unsigned :2;
    unsigned NOT_W:1;
    unsigned :2;
    unsigned NOT_A:1;
  };
  struct {
    unsigned :2;
    unsigned NOT_WRITE:1;
    unsigned :2;
    unsigned NOT_ADDRESS:1;
  };
  struct {
    unsigned :2;
    unsigned READ_WRITE:1;
    unsigned :2;
    unsigned DATA_ADDRESS:1;
  };
  struct {
    unsigned :2;
    unsigned R:1;
    unsigned :2;
    unsigned D:1;
  };
} SSPSTATbits;
extern volatile near unsigned char       SSPADD;
extern volatile near unsigned char       SSPBUF;
extern volatile near unsigned char       T2CON;
extern volatile near union {
  struct {
    unsigned T2CKPS:2;
    unsigned TMR2ON:1;
    unsigned TOUTPS:4;
  };
  struct {
    unsigned T2CKPS0:1;
    unsigned T2CKPS1:1;
    unsigned :1;
    unsigned T2OUTPS0:1;
    unsigned T2OUTPS1:1;
    unsigned T2OUTPS2:1;
    unsigned T2OUTPS3:1;
  };
  struct {
    unsigned :3;
    unsigned TOUTPS0:1;
    unsigned TOUTPS1:1;
    unsigned TOUTPS2:1;
    unsigned TOUTPS3:1;
  };
} T2CONbits;
extern volatile near unsigned char       PR2;
extern volatile near unsigned char       TMR2;
extern volatile near unsigned char       T1CON;
extern volatile near union {
  struct {
    unsigned TMR1ON:1;
    unsigned TMR1CS:1;
    unsigned NOT_T1SYNC:1;
    unsigned T1OSCEN:1;
    unsigned T1CKPS:2;
    unsigned T1RUN:1;
    unsigned RD16:1;
  };
  struct {
    unsigned :2;
    unsigned T1SYNC:1;
    unsigned :1;
    unsigned T1CKPS0:1;
    unsigned T1CKPS1:1;
  };
} T1CONbits;
extern volatile near unsigned char       TMR1L;
extern volatile near unsigned char       TMR1H;
extern volatile near unsigned char       RCON;
extern volatile near union {
  struct {
    unsigned NOT_BOR:1;
    unsigned NOT_POR:1;
    unsigned NOT_PD:1;
    unsigned NOT_TO:1;
    unsigned NOT_RI:1;
    unsigned :1;
    unsigned SBOREN:1;
    unsigned IPEN:1;
  };
  struct {
    unsigned BOR:1;
    unsigned POR:1;
    unsigned PD:1;
    unsigned TO:1;
    unsigned RI:1;
    unsigned :2;
    unsigned NOT_IPEN:1;
  };
} RCONbits;
extern volatile near unsigned char       WDTCON;
extern volatile near union {
  struct {
    unsigned SWDTEN:1;
  };
  struct {
    unsigned SWDTE:1;
  };
} WDTCONbits;
extern volatile near unsigned char       HLVDCON;
extern volatile near union {
  struct {
    unsigned HLVDL:4;
    unsigned HLVDEN:1;
    unsigned IRVST:1;
    unsigned :1;
    unsigned VDIRMAG:1;
  };
  struct {
    unsigned HLVDL0:1;
    unsigned HLVDL1:1;
    unsigned HLVDL2:1;
    unsigned HLVDL3:1;
  };
  struct {
    unsigned LVDL0:1;
    unsigned LVDL1:1;
    unsigned LVDL2:1;
    unsigned LVDL3:1;
    unsigned LVDEN:1;
    unsigned IVRST:1;
  };
  struct {
    unsigned LVV0:1;
    unsigned LVV1:1;
    unsigned LVV2:1;
    unsigned LVV3:1;
    unsigned :1;
    unsigned BGST:1;
  };
} HLVDCONbits;
extern volatile near unsigned char       LVDCON;
extern volatile near union {
  struct {
    unsigned HLVDL:4;
    unsigned HLVDEN:1;
    unsigned IRVST:1;
    unsigned :1;
    unsigned VDIRMAG:1;
  };
  struct {
    unsigned HLVDL0:1;
    unsigned HLVDL1:1;
    unsigned HLVDL2:1;
    unsigned HLVDL3:1;
  };
  struct {
    unsigned LVDL0:1;
    unsigned LVDL1:1;
    unsigned LVDL2:1;
    unsigned LVDL3:1;
    unsigned LVDEN:1;
    unsigned IVRST:1;
  };
  struct {
    unsigned LVV0:1;
    unsigned LVV1:1;
    unsigned LVV2:1;
    unsigned LVV3:1;
    unsigned :1;
    unsigned BGST:1;
  };
} LVDCONbits;
extern volatile near unsigned char       OSCCON;
extern volatile near union {
  struct {
    unsigned SCS:2;
    unsigned IOFS:1;
    unsigned OSTS:1;
    unsigned IRCF:3;
    unsigned IDLEN:1;
  };
  struct {
    unsigned SCS0:1;
    unsigned SCS1:1;
    unsigned FLTS:1;
    unsigned :1;
    unsigned IRCF0:1;
    unsigned IRCF1:1;
    unsigned IRCF2:1;
  };
} OSCCONbits;
extern volatile near unsigned char       T0CON;
extern volatile near union {
  struct {
    unsigned T0PS:3;
    unsigned PSA:1;
    unsigned T0SE:1;
    unsigned T0CS:1;
    unsigned T08BIT:1;
    unsigned TMR0ON:1;
  };
  struct {
    unsigned T0PS0:1;
    unsigned T0PS1:1;
    unsigned T0PS2:1;
  };
} T0CONbits;
extern volatile near unsigned char       TMR0L;
extern volatile near unsigned char       TMR0H;
extern          near unsigned char       STATUS;
extern          near struct {
  unsigned C:1;
  unsigned DC:1;
  unsigned Z:1;
  unsigned OV:1;
  unsigned N:1;
} STATUSbits;
extern          near unsigned            FSR2;
extern          near unsigned char       FSR2L;
extern          near unsigned char       FSR2H;
extern volatile near unsigned char       PLUSW2;
extern volatile near unsigned char       PREINC2;
extern volatile near unsigned char       POSTDEC2;
extern volatile near unsigned char       POSTINC2;
extern          near unsigned char       INDF2;
extern          near unsigned char       BSR;
extern          near unsigned            FSR1;
extern          near unsigned char       FSR1L;
extern          near unsigned char       FSR1H;
extern volatile near unsigned char       PLUSW1;
extern volatile near unsigned char       PREINC1;
extern volatile near unsigned char       POSTDEC1;
extern volatile near unsigned char       POSTINC1;
extern          near unsigned char       INDF1;
extern          near unsigned char       WREG;
extern          near unsigned            FSR0;
extern          near unsigned char       FSR0L;
extern          near unsigned char       FSR0H;
extern volatile near unsigned char       PLUSW0;
extern volatile near unsigned char       PREINC0;
extern volatile near unsigned char       POSTDEC0;
extern volatile near unsigned char       POSTINC0;
extern          near unsigned char       INDF0;
extern volatile near unsigned char       INTCON3;
extern volatile near union {
  struct {
    unsigned INT1IF:1;
    unsigned INT2IF:1;
    unsigned :1;
    unsigned INT1IE:1;
    unsigned INT2IE:1;
    unsigned :1;
    unsigned INT1IP:1;
    unsigned INT2IP:1;
  };
  struct {
    unsigned INT1F:1;
    unsigned INT2F:1;
    unsigned :1;
    unsigned INT1E:1;
    unsigned INT2E:1;
    unsigned :1;
    unsigned INT1P:1;
    unsigned INT2P:1;
  };
} INTCON3bits;
extern volatile near unsigned char       INTCON2;
extern volatile near union {
  struct {
    unsigned RBIP:1;
    unsigned :1;
    unsigned TMR0IP:1;
    unsigned :1;
    unsigned INTEDG2:1;
    unsigned INTEDG1:1;
    unsigned INTEDG0:1;
    unsigned NOT_RBPU:1;
  };
  struct {
    unsigned :2;
    unsigned T0IP:1;
    unsigned :4;
    unsigned RBPU:1;
  };
} INTCON2bits;
extern volatile near unsigned char       INTCON;
extern volatile near union {
  struct {
    unsigned RBIF:1;
    unsigned INT0IF:1;
    unsigned TMR0IF:1;
    unsigned RBIE:1;
    unsigned INT0IE:1;
    unsigned TMR0IE:1;
    unsigned PEIE_GIEL:1;
    unsigned GIE_GIEH:1;
  };
  struct {
    unsigned :1;
    unsigned INT0F:1;
    unsigned T0IF:1;
    unsigned :1;
    unsigned INT0E:1;
    unsigned T0IE:1;
    unsigned PEIE:1;
    unsigned GIE:1;
  };
  struct {
    unsigned :6;
    unsigned GIEL:1;
    unsigned GIEH:1;
  };
} INTCONbits;
extern          near unsigned            PROD;
extern          near unsigned char       PRODL;
extern          near unsigned char       PRODH;
extern volatile near unsigned char       TABLAT;
extern volatile near unsigned short long TBLPTR;
extern volatile near unsigned char       TBLPTRL;
extern volatile near unsigned char       TBLPTRH;
extern volatile near unsigned char       TBLPTRU;
extern volatile near unsigned short long PC;
extern volatile near unsigned char       PCL;
extern volatile near unsigned char       PCLATH;
extern volatile near unsigned char       PCLATU;
extern volatile near unsigned char       STKPTR;
extern volatile near union {
  struct {
    unsigned STKPTR:5;
    unsigned :1;
    unsigned STKUNF:1;
    unsigned STKFUL:1;
  };
  struct {
    unsigned STKPTR0:1;
    unsigned STKPTR1:1;
    unsigned STKPTR2:1;
    unsigned STKPTR3:1;
    unsigned STKPTR4:1;
  };
  struct {
    unsigned :7;
    unsigned STKOVF:1;
  };
} STKPTRbits;
extern          near unsigned short long TOS;
extern          near unsigned char       TOSL;
extern          near unsigned char       TOSH;
extern          near unsigned char       TOSU;



#line 1501 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
 
#line 1503 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1504 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"


#line 1507 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
 
#line 1509 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1510 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1511 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1512 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"

#line 1514 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1515 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1516 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1517 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 1518 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"


#line 1522 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
 
#line 1524 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"


#line 1527 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18f4550.h"
#line 213 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"

#line 215 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 217 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 219 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 221 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 223 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 225 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 227 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 229 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 231 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 233 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 235 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 237 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 239 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 241 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 243 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 245 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 247 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 249 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 251 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 253 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 255 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 257 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 259 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 261 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 263 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 265 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 267 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 269 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 271 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 273 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 275 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 277 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 279 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 281 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 283 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 285 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 287 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 289 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 291 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 293 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 295 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 297 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 299 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 301 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 303 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 305 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 307 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 309 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 311 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 313 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 315 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 317 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 319 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 321 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 323 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 325 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 327 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 329 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 331 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 333 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 335 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 337 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 339 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 341 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 343 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 345 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 347 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 349 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 351 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 353 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 355 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 357 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 359 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 361 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 363 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 365 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 367 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 369 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 371 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 373 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 375 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 377 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 379 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 381 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 383 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 385 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 387 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 389 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 391 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 393 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 395 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 397 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 399 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 401 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 403 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 405 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 407 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 409 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 411 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 413 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 415 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 417 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 419 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 421 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 423 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 425 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 427 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 429 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 431 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 433 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 435 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 437 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 439 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 441 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 443 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 445 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 447 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 449 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 451 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 453 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 455 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 457 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 459 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 461 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 463 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 465 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 467 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 469 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 471 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 473 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 475 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 477 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 479 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 481 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 483 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 485 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 487 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 489 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 491 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 493 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 495 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 497 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 499 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 501 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 503 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 505 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 507 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 509 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 511 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 513 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 515 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 517 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 519 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 521 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 523 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 525 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 527 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 529 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 531 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 533 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 535 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 537 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 539 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 541 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 543 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 545 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 547 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 549 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 551 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 553 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 555 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 557 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 559 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 561 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 563 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 565 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 567 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 569 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 571 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 573 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 575 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 577 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 579 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 581 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 583 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 585 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 587 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 589 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 591 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 593 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 595 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 597 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"

#line 599 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/p18cxxx.h"
#line 27 "source/user_solutions.c"




#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 


#line 39 "source/typedefs.h"

typedef unsigned char   byte;           
typedef unsigned int    word;           
typedef unsigned long   dword;          

typedef union _BYTE
{
    byte _byte;
    struct
    {
        unsigned b0:1;
        unsigned b1:1;
        unsigned b2:1;
        unsigned b3:1;
        unsigned b4:1;
        unsigned b5:1;
        unsigned b6:1;
        unsigned b7:1;
    };
} BYTE;

typedef union _WORD
{
    word _word;
    struct
    {
        byte byte0;
        byte byte1;
    };
    struct
    {
        BYTE Byte0;
        BYTE Byte1;
    };
    struct
    {
        BYTE LowB;
        BYTE HighB;
    };
    struct
    {
        byte v[2];
    };
} WORD;
#line 84 "source/typedefs.h"
#line 85 "source/typedefs.h"

typedef union _DWORD
{
    dword _dword;
    struct
    {
        byte byte0;
        byte byte1;
        byte byte2;
        byte byte3;
    };
    struct
    {
        word word0;
        word word1;
    };
    struct
    {
        BYTE Byte0;
        BYTE Byte1;
        BYTE Byte2;
        BYTE Byte3;
    };
    struct
    {
        WORD Word0;
        WORD Word1;
    };
    struct
    {
        byte v[4];
    };
} DWORD;
#line 119 "source/typedefs.h"
#line 120 "source/typedefs.h"
#line 121 "source/typedefs.h"
#line 122 "source/typedefs.h"

typedef void(*pFunc)(void);

typedef union _POINTER
{
    struct
    {
        byte bLow;
        byte bHigh;
        
    };
    word _word;                         
    
    

    byte* bRam;                         
                                        
    word* wRam;                         
                                        

    rom byte* bRom;                     
    rom word* wRom;
    
    
    
    
} POINTER;

typedef enum _BOOL { FALSE = 0, TRUE } BOOL;

#line 153 "source/typedefs.h"
#line 154 "source/typedefs.h"

#line 156 "source/typedefs.h"
#line 31 "source/user_solutions.c"


#line 1 "source/usb.h"

#line 35 "source/usb.h"
 

#line 38 "source/usb.h"


#line 45 "source/usb.h"
 

#line 1 "source/usbcfg.h"

#line 32 "source/usbcfg.h"
 


#line 36 "source/usbcfg.h"

 
#line 39 "source/usbcfg.h"
#line 40 "source/usbcfg.h"

 
#line 43 "source/usbcfg.h"
#line 44 "source/usbcfg.h"




 
#line 50 "source/usbcfg.h"


#line 55 "source/usbcfg.h"
 
#line 57 "source/usbcfg.h"
#line 58 "source/usbcfg.h"
#line 59 "source/usbcfg.h"
#line 60 "source/usbcfg.h"
#line 61 "source/usbcfg.h"

 

#line 65 "source/usbcfg.h"
 

 
#line 69 "source/usbcfg.h"
#line 70 "source/usbcfg.h"
#line 71 "source/usbcfg.h"
#line 72 "source/usbcfg.h"

#line 74 "source/usbcfg.h"
#line 75 "source/usbcfg.h"
#line 76 "source/usbcfg.h"
#line 77 "source/usbcfg.h"
#line 78 "source/usbcfg.h"
#line 79 "source/usbcfg.h"

#line 81 "source/usbcfg.h"

#line 83 "source/usbcfg.h"
#line 47 "source/usb.h"

#line 1 "source/usbdefs_std_dsc.h"

#line 35 "source/usbdefs_std_dsc.h"
 


#line 39 "source/usbdefs_std_dsc.h"
 

#line 42 "source/usbdefs_std_dsc.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 44 "source/usbdefs_std_dsc.h"


 

 
#line 50 "source/usbdefs_std_dsc.h"
#line 51 "source/usbdefs_std_dsc.h"
#line 52 "source/usbdefs_std_dsc.h"
#line 53 "source/usbdefs_std_dsc.h"
#line 54 "source/usbdefs_std_dsc.h"


#line 62 "source/usbdefs_std_dsc.h"
 
#line 64 "source/usbdefs_std_dsc.h"
#line 65 "source/usbdefs_std_dsc.h"
#line 66 "source/usbdefs_std_dsc.h"
#line 67 "source/usbdefs_std_dsc.h"
#line 68 "source/usbdefs_std_dsc.h"
#line 69 "source/usbdefs_std_dsc.h"
#line 70 "source/usbdefs_std_dsc.h"
#line 71 "source/usbdefs_std_dsc.h"
#line 72 "source/usbdefs_std_dsc.h"
#line 73 "source/usbdefs_std_dsc.h"
#line 74 "source/usbdefs_std_dsc.h"
#line 75 "source/usbdefs_std_dsc.h"
#line 76 "source/usbdefs_std_dsc.h"
#line 77 "source/usbdefs_std_dsc.h"
#line 78 "source/usbdefs_std_dsc.h"
#line 79 "source/usbdefs_std_dsc.h"
#line 80 "source/usbdefs_std_dsc.h"
#line 81 "source/usbdefs_std_dsc.h"
#line 82 "source/usbdefs_std_dsc.h"
#line 83 "source/usbdefs_std_dsc.h"
#line 84 "source/usbdefs_std_dsc.h"
#line 85 "source/usbdefs_std_dsc.h"
#line 86 "source/usbdefs_std_dsc.h"
#line 87 "source/usbdefs_std_dsc.h"
#line 88 "source/usbdefs_std_dsc.h"
#line 89 "source/usbdefs_std_dsc.h"
#line 90 "source/usbdefs_std_dsc.h"
#line 91 "source/usbdefs_std_dsc.h"
#line 92 "source/usbdefs_std_dsc.h"
#line 93 "source/usbdefs_std_dsc.h"

 
#line 96 "source/usbdefs_std_dsc.h"
#line 97 "source/usbdefs_std_dsc.h"
#line 98 "source/usbdefs_std_dsc.h"

 
#line 101 "source/usbdefs_std_dsc.h"
#line 102 "source/usbdefs_std_dsc.h"
#line 103 "source/usbdefs_std_dsc.h"
#line 104 "source/usbdefs_std_dsc.h"

 
#line 107 "source/usbdefs_std_dsc.h"
#line 108 "source/usbdefs_std_dsc.h"
#line 109 "source/usbdefs_std_dsc.h"
#line 110 "source/usbdefs_std_dsc.h"

 
#line 113 "source/usbdefs_std_dsc.h"
#line 114 "source/usbdefs_std_dsc.h"
#line 115 "source/usbdefs_std_dsc.h"


 


#line 121 "source/usbdefs_std_dsc.h"
 
typedef struct _USB_DEV_DSC
{
    byte bLength;       byte bDscType;      word bcdUSB;
    byte bDevCls;       byte bDevSubCls;    byte bDevProtocol;
    byte bMaxPktSize0;  word idVendor;      word idProduct;
    word bcdDevice;     byte iMFR;          byte iProduct;
    byte iSerialNum;    byte bNumCfg;
} USB_DEV_DSC;


#line 133 "source/usbdefs_std_dsc.h"
 
typedef struct _USB_CFG_DSC
{
    byte bLength;       byte bDscType;      word wTotalLength;
    byte bNumIntf;      byte bCfgValue;     byte iCfg;
    byte bmAttributes;  byte bMaxPower;
} USB_CFG_DSC;


#line 143 "source/usbdefs_std_dsc.h"
 
typedef struct _USB_INTF_DSC
{
    byte bLength;       byte bDscType;      byte bIntfNum;
    byte bAltSetting;   byte bNumEPs;       byte bIntfCls;
    byte bIntfSubCls;   byte bIntfProtocol; byte iIntf;
} USB_INTF_DSC;


#line 153 "source/usbdefs_std_dsc.h"
 
typedef struct _USB_EP_DSC
{
    byte bLength;       byte bDscType;      byte bEPAdr;
    byte bmAttributes;  word wMaxPktSize;   byte bInterval;
} USB_EP_DSC;

#line 161 "source/usbdefs_std_dsc.h"
#line 48 "source/usb.h"

#line 1 "source/usbdsc.h"

#line 32 "source/usbdsc.h"
 


#line 37 "source/usbdsc.h"
 


#line 41 "source/usbdsc.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 43 "source/usbdsc.h"

#line 1 "source/usbcfg.h"

#line 32 "source/usbcfg.h"
 


#line 55 "source/usbcfg.h"

#line 65 "source/usbcfg.h"
#line 83 "source/usbcfg.h"
#line 44 "source/usbdsc.h"


#line 47 "source/usbdsc.h"
#line 1 "source/cdc.h"

#line 35 "source/cdc.h"
 

#line 38 "source/cdc.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 40 "source/cdc.h"


 

 
#line 46 "source/cdc.h"
#line 47 "source/cdc.h"
#line 48 "source/cdc.h"
#line 49 "source/cdc.h"
#line 50 "source/cdc.h"
#line 51 "source/cdc.h"
#line 52 "source/cdc.h"
#line 53 "source/cdc.h"
#line 54 "source/cdc.h"


#line 58 "source/cdc.h"
 
#line 60 "source/cdc.h"
#line 61 "source/cdc.h"
#line 62 "source/cdc.h"


 
#line 66 "source/cdc.h"

 
#line 69 "source/cdc.h"

 
#line 72 "source/cdc.h"

 
#line 75 "source/cdc.h"


 
#line 79 "source/cdc.h"

 
#line 82 "source/cdc.h"


 
#line 86 "source/cdc.h"
#line 87 "source/cdc.h"

 
 
#line 91 "source/cdc.h"
#line 92 "source/cdc.h"

 
#line 95 "source/cdc.h"
#line 96 "source/cdc.h"
#line 97 "source/cdc.h"
#line 98 "source/cdc.h"
#line 99 "source/cdc.h"
#line 100 "source/cdc.h"
#line 101 "source/cdc.h"
#line 102 "source/cdc.h"
#line 103 "source/cdc.h"
#line 104 "source/cdc.h"
 

 
#line 108 "source/cdc.h"
#line 109 "source/cdc.h"
#line 110 "source/cdc.h"
#line 111 "source/cdc.h"


#line 128 "source/cdc.h"
 
#line 130 "source/cdc.h"


#line 147 "source/cdc.h"
 
#line 149 "source/cdc.h"


#line 166 "source/cdc.h"
 
#line 168 "source/cdc.h"


#line 185 "source/cdc.h"
 
#line 187 "source/cdc.h"


#line 214 "source/cdc.h"
 

#line 221 "source/cdc.h"
#line 222 "source/cdc.h"


#line 249 "source/cdc.h"
 

#line 256 "source/cdc.h"
#line 257 "source/cdc.h"

 

 
#line 262 "source/cdc.h"

typedef union _LINE_CODING
{
    struct
    {
        byte _byte[0x07 ];
    };
    struct
    {
        DWORD   dwDTERate;          
        byte    bCharFormat;
        byte    bParityType;
        byte    bDataBits;
    };
} LINE_CODING;

typedef union _CONTROL_SIGNAL_BITMAP
{
    byte _byte;
    struct
    {
        unsigned DTE_PRESENT;       
        unsigned CARRIER_CONTROL;   
    };
} CONTROL_SIGNAL_BITMAP;


 

 
typedef struct _USB_CDC_HEADER_FN_DSC
{
    byte bFNLength;
    byte bDscType;
    byte bDscSubType;
    word bcdCDC;
} USB_CDC_HEADER_FN_DSC;

 
typedef struct _USB_CDC_ACM_FN_DSC
{
    byte bFNLength;
    byte bDscType;
    byte bDscSubType;
    byte bmCapabilities;
} USB_CDC_ACM_FN_DSC;

 
typedef struct _USB_CDC_UNION_FN_DSC
{
    byte bFNLength;
    byte bDscType;
    byte bDscSubType;
    byte bMasterIntf;
    byte bSaveIntf0;
} USB_CDC_UNION_FN_DSC;

 
typedef struct _USB_CDC_CALL_MGT_FN_DSC
{
    byte bFNLength;
    byte bDscType;
    byte bDscSubType;
    byte bmCapabilities;
    byte bDataInterface;
} USB_CDC_CALL_MGT_FN_DSC;

 
extern byte cdc_rx_len;

extern byte cdc_trf_state;
extern POINTER pCDCSrc;
extern byte cdc_tx_len;
extern byte cdc_mem_type;

 
void USBCheckCDCRequest(void);
void CDCInitEP(void);
byte getsUSBUSART(char *buffer, byte len);
void putrsUSBUSART(const rom char *data);
void putsUSBUSART(char *data);
void CDCTxService(void);

#line 346 "source/cdc.h"
#line 47 "source/usbdsc.h"

#line 49 "source/usbdsc.h"

#line 1 "source/usb.h"

#line 35 "source/usb.h"
 

#line 45 "source/usb.h"
#line 59 "source/usb.h"
#line 61 "source/usb.h"
#line 63 "source/usb.h"
#line 50 "source/usbdsc.h"


 


#line 65 "source/usbdsc.h"
#line 66 "source/usbdsc.h"

 
extern rom USB_DEV_DSC device_dsc;
extern rom struct { USB_CFG_DSC cd01; USB_INTF_DSC i01a00; USB_CDC_HEADER_FN_DSC cdc_header_fn_i01a00; USB_CDC_ACM_FN_DSC cdc_acm_fn_i01a00; USB_CDC_UNION_FN_DSC cdc_union_fn_i01a00; USB_CDC_CALL_MGT_FN_DSC cdc_call_mgt_fn_i01a00; USB_EP_DSC ep02i_i01a00; USB_INTF_DSC i02a00; USB_EP_DSC ep03o_i02a00; USB_EP_DSC ep03i_i02a00; } cfg01 ;
extern rom const unsigned char *rom USB_CD_Ptr[];
extern rom const unsigned char *rom USB_SD_Ptr[];

extern rom pFunc ClassReqHandler[1];

#line 76 "source/usbdsc.h"
#line 49 "source/usb.h"


#line 1 "source/usbdefs_ep0_buff.h"

#line 35 "source/usbdefs_ep0_buff.h"
 


#line 39 "source/usbdefs_ep0_buff.h"
 

#line 42 "source/usbdefs_ep0_buff.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 44 "source/usbdefs_ep0_buff.h"

#line 1 "source/usbcfg.h"

#line 32 "source/usbcfg.h"
 


#line 55 "source/usbcfg.h"

#line 65 "source/usbcfg.h"
#line 83 "source/usbcfg.h"
#line 45 "source/usbdefs_ep0_buff.h"
       


#line 58 "source/usbdefs_ep0_buff.h"
 
typedef union _CTRL_TRF_SETUP
{
     
    struct
    {
        byte _byte[8 ];
    };
    
     
    struct
    {
        byte bmRequestType;
        byte bRequest;    
        word wValue;
        word wIndex;
        word wLength;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        WORD W_Value;
        WORD W_Index;
        WORD W_Length;
    };
    struct
    {
        unsigned Recipient:5;           
        unsigned RequestType:2;         
        unsigned DataDir:1;             
        unsigned :8;
        byte bFeature;                  
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned :8;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        byte bDscIndex;                 
        byte bDscType;                  
        word wLangID;                   
        unsigned :8;
        unsigned :8;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        BYTE bDevADR;                   
        byte bDevADRH;                  
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned :8;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        byte bCfgValue;                 
        byte bCfgRSD;                   
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned :8;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        byte bAltID;                    
        byte bAltID_H;                  
        byte bIntfID;                   
        byte bIntfID_H;                 
        unsigned :8;
        unsigned :8;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned :8;
        byte bEPID;                     
        byte bEPID_H;                   
        unsigned :8;
        unsigned :8;
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned :8;
        unsigned EPNum:4;               
        unsigned :3;
        unsigned EPDir:1;               
        unsigned :8;
        unsigned :8;
        unsigned :8;
    };
     
    
} CTRL_TRF_SETUP;


#line 178 "source/usbdefs_ep0_buff.h"
 
typedef union _CTRL_TRF_DATA
{
     
    struct
    {
        byte _byte[8 ];
    };
    
     
    struct
    {
        byte _byte0;
        byte _byte1;
        byte _byte2;
        byte _byte3;
        byte _byte4;
        byte _byte5;
        byte _byte6;
        byte _byte7;
    };
    struct
    {
        word _word0;
        word _word1;
        word _word2;
        word _word3;
    };

} CTRL_TRF_DATA;

#line 210 "source/usbdefs_ep0_buff.h"
#line 51 "source/usb.h"

#line 1 "source/usbmmap.h"

#line 35 "source/usbmmap.h"
 


#line 39 "source/usbmmap.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 41 "source/usbmmap.h"


 

 
#line 47 "source/usbmmap.h"
#line 48 "source/usbmmap.h"
#line 49 "source/usbmmap.h"
#line 50 "source/usbmmap.h"
#line 51 "source/usbmmap.h"
#line 52 "source/usbmmap.h"
#line 53 "source/usbmmap.h"
#line 54 "source/usbmmap.h"
#line 55 "source/usbmmap.h"

 
#line 58 "source/usbmmap.h"
#line 59 "source/usbmmap.h"
#line 60 "source/usbmmap.h"
#line 61 "source/usbmmap.h"
#line 62 "source/usbmmap.h"
#line 63 "source/usbmmap.h"
#line 64 "source/usbmmap.h"

 
#line 67 "source/usbmmap.h"
#line 68 "source/usbmmap.h"

 
typedef union _USB_DEVICE_STATUS
{
    byte _byte;
    struct
    {
        unsigned RemoteWakeup:1;
        unsigned ctrl_trf_mem:1;
    };
} USB_DEVICE_STATUS;

typedef union _BD_STAT
{
    byte _byte;
    struct{
        unsigned BC8:1;
        unsigned BC9:1;
        unsigned BSTALL:1;              
        unsigned DTSEN:1;               
        unsigned INCDIS:1;              
        unsigned KEN:1;                 
        unsigned DTS:1;                 
        unsigned UOWN:1;                
    };
    struct{
        unsigned BC8:1;
        unsigned BC9:1;
        unsigned PID0:1;
        unsigned PID1:1;
        unsigned PID2:1;
        unsigned PID3:1;
        unsigned :1;
        unsigned UOWN:1;
    };
    struct{
        unsigned :2;
        unsigned PID:4;                 
        unsigned :2;
    };
} BD_STAT;                              

typedef union _BDT
{
    struct
    {
        BD_STAT Stat;
        byte Cnt;
        byte ADRL;                      
        byte ADRH;                      
    };
    struct
    {
        unsigned :8;
        unsigned :8;
        byte* ADR;                      
    };
} BDT;                                  

 
extern byte usb_device_state;
extern USB_DEVICE_STATUS usb_stat;
extern byte usb_active_cfg;
extern byte usb_alt_intf[1 ];

extern volatile far BDT ep0Bo;          
extern volatile far BDT ep0Bi;          
extern volatile far BDT ep1Bo;          
extern volatile far BDT ep1Bi;          
extern volatile far BDT ep2Bo;          
extern volatile far BDT ep2Bi;          
extern volatile far BDT ep3Bo;          
extern volatile far BDT ep3Bi;          
extern volatile far BDT ep4Bo;          
extern volatile far BDT ep4Bi;          
extern volatile far BDT ep5Bo;          
extern volatile far BDT ep5Bi;          
extern volatile far BDT ep6Bo;          
extern volatile far BDT ep6Bi;          
extern volatile far BDT ep7Bo;          
extern volatile far BDT ep7Bi;          
extern volatile far BDT ep8Bo;          
extern volatile far BDT ep8Bi;          
extern volatile far BDT ep9Bo;          
extern volatile far BDT ep9Bi;          
extern volatile far BDT ep10Bo;         
extern volatile far BDT ep10Bi;         
extern volatile far BDT ep11Bo;         
extern volatile far BDT ep11Bi;         
extern volatile far BDT ep12Bo;         
extern volatile far BDT ep12Bi;         
extern volatile far BDT ep13Bo;         
extern volatile far BDT ep13Bi;         
extern volatile far BDT ep14Bo;         
extern volatile far BDT ep14Bi;         
extern volatile far BDT ep15Bo;         
extern volatile far BDT ep15Bi;         

extern volatile far CTRL_TRF_SETUP SetupPkt;
extern volatile far CTRL_TRF_DATA CtrlTrfData;

#line 170 "source/usbmmap.h"
extern volatile far unsigned char cdc_notice[8 ];
extern volatile far unsigned char cdc_data_rx[64 ];
extern volatile far unsigned char cdc_data_tx[64 ];
#line 174 "source/usbmmap.h"

#line 176 "source/usbmmap.h"
#line 52 "source/usb.h"


#line 1 "source/usbdrv.h"

#line 35 "source/usbdrv.h"
 


#line 39 "source/usbdrv.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 41 "source/usbdrv.h"

#line 1 "source/usb.h"

#line 35 "source/usb.h"
 

#line 45 "source/usb.h"
#line 59 "source/usb.h"
#line 61 "source/usb.h"
#line 63 "source/usb.h"
#line 42 "source/usbdrv.h"


 

 
#line 48 "source/usbdrv.h"
#line 49 "source/usbdrv.h"
#line 50 "source/usbdrv.h"
#line 51 "source/usbdrv.h"
#line 52 "source/usbdrv.h"
#line 53 "source/usbdrv.h"
#line 54 "source/usbdrv.h"
#line 55 "source/usbdrv.h"
#line 56 "source/usbdrv.h"
#line 57 "source/usbdrv.h"

 
#line 60 "source/usbdrv.h"
#line 61 "source/usbdrv.h"
#line 62 "source/usbdrv.h"
#line 63 "source/usbdrv.h"
#line 64 "source/usbdrv.h"
                                    


#line 74 "source/usbdrv.h"
 
#line 76 "source/usbdrv.h"
#line 77 "source/usbdrv.h"

#line 79 "source/usbdrv.h"
#line 80 "source/usbdrv.h"

#line 82 "source/usbdrv.h"
#line 83 "source/usbdrv.h"
#line 84 "source/usbdrv.h"
#line 85 "source/usbdrv.h"
#line 86 "source/usbdrv.h"
#line 87 "source/usbdrv.h"
#line 88 "source/usbdrv.h"
#line 89 "source/usbdrv.h"
#line 90 "source/usbdrv.h"
#line 91 "source/usbdrv.h"
#line 92 "source/usbdrv.h"
#line 93 "source/usbdrv.h"
#line 94 "source/usbdrv.h"
#line 95 "source/usbdrv.h"
#line 96 "source/usbdrv.h"
#line 97 "source/usbdrv.h"
#line 98 "source/usbdrv.h"
#line 99 "source/usbdrv.h"
#line 100 "source/usbdrv.h"
#line 101 "source/usbdrv.h"
#line 102 "source/usbdrv.h"
#line 103 "source/usbdrv.h"
#line 104 "source/usbdrv.h"
#line 105 "source/usbdrv.h"
#line 106 "source/usbdrv.h"
#line 107 "source/usbdrv.h"
#line 108 "source/usbdrv.h"
#line 109 "source/usbdrv.h"
#line 110 "source/usbdrv.h"
#line 111 "source/usbdrv.h"
#line 112 "source/usbdrv.h"
#line 113 "source/usbdrv.h"


#line 134 "source/usbdrv.h"
 

#line 138 "source/usbdrv.h"
#line 139 "source/usbdrv.h"


#line 156 "source/usbdrv.h"
 
#line 158 "source/usbdrv.h"

#line 162 "source/usbdrv.h"

#line 163 "source/usbdrv.h"
 


#line 187 "source/usbdrv.h"
 

#line 193 "source/usbdrv.h"
#line 194 "source/usbdrv.h"

 

 

 
void USBCheckBusStatus(void);
void USBDriverService(void);
void USBRemoteWakeup(void);
void USBSoftDetach(void); 

void ClearArray(byte* startAdr,byte count);
#line 207 "source/usbdrv.h"
#line 54 "source/usb.h"

#line 1 "source/usbctrltrf.h"

#line 35 "source/usbctrltrf.h"
 

#line 38 "source/usbctrltrf.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 40 "source/usbctrltrf.h"


 

 
#line 46 "source/usbctrltrf.h"
#line 47 "source/usbctrltrf.h"
#line 48 "source/usbctrltrf.h"

 
#line 51 "source/usbctrltrf.h"
#line 52 "source/usbctrltrf.h"
#line 53 "source/usbctrltrf.h"

 
#line 56 "source/usbctrltrf.h"
#line 57 "source/usbctrltrf.h"

#line 59 "source/usbctrltrf.h"
#line 60 "source/usbctrltrf.h"
#line 61 "source/usbctrltrf.h"

#line 63 "source/usbctrltrf.h"
#line 64 "source/usbctrltrf.h"
#line 65 "source/usbctrltrf.h"
#line 66 "source/usbctrltrf.h"

 
extern byte ctrl_trf_session_owner;

extern POINTER pSrc;
extern POINTER pDst;
extern WORD wCount;

 
void USBCtrlEPService(void);
void USBCtrlTrfTxService(void);
void USBCtrlTrfRxService(void);
void USBCtrlEPServiceComplete(void);
void USBPrepareForNextSetupTrf(void);


#line 83 "source/usbctrltrf.h"
#line 55 "source/usb.h"

#line 1 "source/usb9.h"

#line 35 "source/usb9.h"
 

#line 38 "source/usb9.h"

 
#line 1 "source/typedefs.h"

#line 35 "source/typedefs.h"
 

#line 156 "source/typedefs.h"
#line 40 "source/usb9.h"


 


#line 47 "source/usb9.h"
 
#line 49 "source/usb9.h"
#line 50 "source/usb9.h"
#line 51 "source/usb9.h"
#line 52 "source/usb9.h"
#line 53 "source/usb9.h"
#line 54 "source/usb9.h"
#line 55 "source/usb9.h"
#line 56 "source/usb9.h"
#line 57 "source/usb9.h"
#line 58 "source/usb9.h"
#line 59 "source/usb9.h"

 
#line 62 "source/usb9.h"
#line 63 "source/usb9.h"


#line 79 "source/usb9.h"
 

#line 87 "source/usb9.h"
#line 88 "source/usb9.h"

 

 
void USBCheckStdRequest(void);

#line 95 "source/usb9.h"
#line 56 "source/usb.h"


#line 59 "source/usb.h"
#line 1 "source/cdc.h"

#line 35 "source/cdc.h"
 

#line 58 "source/cdc.h"

#line 128 "source/cdc.h"

#line 147 "source/cdc.h"

#line 166 "source/cdc.h"

#line 185 "source/cdc.h"

#line 214 "source/cdc.h"

#line 221 "source/cdc.h"

#line 249 "source/cdc.h"

#line 256 "source/cdc.h"
#line 346 "source/cdc.h"
#line 59 "source/usb.h"

#line 61 "source/usb.h"

#line 63 "source/usb.h"
#line 33 "source/user_solutions.c"


#line 1 "source/io_cfg.h"

#line 35 "source/io_cfg.h"
 


#line 39 "source/io_cfg.h"

 
#line 1 "source/usbcfg.h"

#line 32 "source/usbcfg.h"
 


#line 55 "source/usbcfg.h"

#line 65 "source/usbcfg.h"
#line 83 "source/usbcfg.h"
#line 41 "source/io_cfg.h"


 
#line 45 "source/io_cfg.h"
#line 46 "source/io_cfg.h"

 
#line 49 "source/io_cfg.h"




#line 54 "source/io_cfg.h"
#line 56 "source/io_cfg.h"
#line 57 "source/io_cfg.h"
#line 58 "source/io_cfg.h"

#line 60 "source/io_cfg.h"




#line 65 "source/io_cfg.h"
#line 67 "source/io_cfg.h"
#line 68 "source/io_cfg.h"
#line 69 "source/io_cfg.h"

#line 71 "source/io_cfg.h"
 
#line 73 "source/io_cfg.h"

#line 75 "source/io_cfg.h"
#line 76 "source/io_cfg.h"
#line 77 "source/io_cfg.h"
#line 78 "source/io_cfg.h"

#line 80 "source/io_cfg.h"
#line 81 "source/io_cfg.h"
#line 82 "source/io_cfg.h"
#line 83 "source/io_cfg.h"

#line 85 "source/io_cfg.h"
#line 86 "source/io_cfg.h"
#line 87 "source/io_cfg.h"
#line 88 "source/io_cfg.h"

#line 90 "source/io_cfg.h"
#line 91 "source/io_cfg.h"
#line 92 "source/io_cfg.h"
#line 93 "source/io_cfg.h"

 
#line 96 "source/io_cfg.h"
#line 97 "source/io_cfg.h"
#line 98 "source/io_cfg.h"
#line 99 "source/io_cfg.h"

#line 101 "source/io_cfg.h"
#line 35 "source/user_solutions.c"
             
#line 1 "source/user.h"

#line 35 "source/user.h"
 


#line 39 "source/user.h"

 
void UserInit(void);
void ProcessIO(void);

#line 45 "source/user.h"
#line 36 "source/user_solutions.c"

#line 1 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"

#line 3 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"

#line 1 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"
 


#line 5 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"

typedef void* va_list;
#line 8 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"
#line 9 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"
#line 10 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"
#line 11 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"
#line 12 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdarg.h"
#line 4 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"

#line 1 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"
 

#line 4 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"

typedef unsigned char wchar_t;


#line 10 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"
 
typedef signed short int ptrdiff_t;
typedef signed short int ptrdiffram_t;
typedef signed short long int ptrdiffrom_t;


#line 20 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"
 
typedef unsigned short int size_t;
typedef unsigned short int sizeram_t;
typedef unsigned short long int sizerom_t;


#line 34 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"
 
#line 36 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"


#line 41 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"
 
#line 43 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"

#line 45 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stddef.h"
#line 5 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"



#line 9 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"
 
#line 11 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"

#line 13 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"


typedef unsigned char FILE;

 
#line 19 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"
#line 20 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"

extern FILE *stderr;
extern FILE *stdout;


int putc (auto char c, auto FILE *f);
int vsprintf (auto char *buf, auto const far  rom char *fmt, auto va_list ap);
int vprintf (auto const far  rom char *fmt, auto va_list ap);
int sprintf (auto char *buf, auto const far  rom char *fmt, ...);
int printf (auto const far  rom char *fmt, ...);
int fprintf (auto FILE *f, auto const far  rom char *fmt, ...);
int vfprintf (auto FILE *f, auto const far  rom char *fmt, auto va_list ap);
int puts (auto const far  rom char *s);
int fputs (auto const far  rom char *s, auto FILE *f);

#line 36 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/stdio.h"
#line 37 "source/user_solutions.c"

#line 1 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"

#line 3 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"

#line 7 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"


#line 20 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
#line 22 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"


#line 25 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
#line 27 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"

 

#line 39 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
void *memcpy (auto void *s1, auto const void *s2, auto size_t n);


#line 55 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
void *memmove (auto void *s1, auto const void *s2, auto size_t n);


#line 67 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strcpy (auto char *s1, auto const char *s2);


#line 83 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strncpy (auto char *s1, auto const char *s2, auto size_t n);


#line 97 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strcat (auto char *s1, auto const char *s2);


#line 113 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strncat (auto char *s1, auto const char *s2, auto size_t n);


#line 128 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char memcmp (auto const void *s1, auto const void *s2, auto size_t n);


#line 141 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strcmp (auto const char *s1, auto const char *s2);


#line 147 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 


#line 161 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strncmp (auto const char *s1, auto const char *s2, auto size_t n);


#line 167 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 


#line 183 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
void *memchr (auto const void *s, auto unsigned char c, auto size_t n);


#line 199 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strchr (auto const char *s, auto unsigned char c);


#line 210 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
size_t strcspn (auto const char *s1, auto const char *s2);


#line 222 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strpbrk (auto const char *s1, auto const char *s2);


#line 238 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strrchr (auto const char *s, auto unsigned char c);


#line 249 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
size_t strspn (auto const char *s1, auto const char *s2);


#line 262 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strstr (auto const char *s1, auto const char *s2);


#line 305 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strtok (auto char *s1, auto const char *s2);


#line 321 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
void *memset (auto void *s, auto unsigned char c, auto size_t n);


#line 339 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
#line 341 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"


#line 349 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
size_t strlen (auto const char *s);


#line 358 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strupr (auto char *s);


#line 367 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strlwr (auto char *s);



 

#line 379 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom void *memcpypgm (auto far  rom void *s1, auto const far  rom void *s2, auto sizerom_t n);


#line 389 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
void *memcpypgm2ram (auto void *s1, auto const far  rom void *s2, auto sizeram_t n);


#line 398 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom void *memcpyram2pgm (auto far  rom void *s1, auto const void *s2, auto sizeram_t n);


#line 407 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom void *memmovepgm (auto far  rom void *s1, auto const far  rom void *s2, auto sizerom_t n);


#line 417 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
void *memmovepgm2ram (auto void *s1, auto const far  rom void *s2, auto sizeram_t n);


#line 426 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom void *memmoveram2pgm (auto far  rom void *s1, auto const void *s2, auto sizeram_t n);


#line 434 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strcpypgm (auto far  rom char *s1, auto const far  rom char *s2);


#line 443 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strcpypgm2ram (auto char *s1, auto const far  rom char *s2);


#line 451 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strcpyram2pgm (auto far  rom char *s1, auto const char *s2);


#line 460 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strncpypgm (auto far  rom char *s1, auto const far  rom char *s2, auto sizerom_t n);


#line 470 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strncpypgm2ram (auto char *s1, auto const far  rom char *s2, auto sizeram_t n);


#line 479 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strncpyram2pgm (auto far  rom char *s1, auto const char *s2, auto sizeram_t n);


#line 487 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strcatpgm (auto far  rom char *s1, auto const far  rom char *s2);


#line 496 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strcatpgm2ram (auto char *s1, auto const far  rom char *s2);


#line 504 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strcatram2pgm (auto far  rom char *s1, auto const char *s2);


#line 513 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strncatpgm (auto far  rom char *s1, auto const far  rom char *s2, auto sizerom_t n);


#line 523 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strncatpgm2ram (auto char *s1, auto const far  rom char *s2, auto sizeram_t n);


#line 532 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strncatram2pgm (auto far  rom char *s1, auto const char *s2, auto sizeram_t n);


#line 541 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char memcmppgm (auto far  rom void *s1, auto const far  rom void *s2, auto sizerom_t n);


#line 551 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char memcmppgm2ram (auto void *s1, auto const far  rom void *s2, auto sizeram_t n);


#line 560 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char memcmpram2pgm (auto far  rom void *s1, auto const void *s2, auto sizeram_t n);


#line 568 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strcmppgm (auto const far  rom char *s1, auto const far  rom char *s2);


#line 577 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strcmppgm2ram (auto const char *s1, auto const far  rom char *s2);


#line 585 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strcmpram2pgm (auto const far  rom char *s1, auto const char *s2);


#line 594 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strncmppgm (auto const far  rom char *s1, auto const far  rom char *s2, auto sizerom_t n);


#line 604 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strncmppgm2ram (auto char *s1, auto const far  rom char *s2, auto sizeram_t n);


#line 613 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
signed char strncmpram2pgm (auto far  rom char *s1, auto const char *s2, auto sizeram_t n);


#line 622 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *memchrpgm (auto const far  rom char *s, auto const unsigned char c, auto sizerom_t n);


#line 631 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strchrpgm (auto const far  rom char *s, auto unsigned char c);


#line 639 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizerom_t strcspnpgm (auto const far  rom char *s1, auto const far  rom char *s2);


#line 647 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizerom_t strcspnpgmram (auto const far  rom char *s1, auto const char *s2);


#line 655 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizeram_t strcspnrampgm (auto const char *s1, auto const far  rom char *s2);


#line 663 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strpbrkpgm (auto const far  rom char *s1, auto const far  rom char *s2);


#line 671 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strpbrkpgmram (auto const far  rom char *s1, auto const char *s2);


#line 679 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strpbrkrampgm (auto const char *s1, auto const far  rom char *s2);


#line 688 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
 


#line 696 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizerom_t strspnpgm (auto const far  rom char *s1, auto const far  rom char *s2);


#line 704 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizerom_t strspnpgmram (auto const far  rom char *s1, auto const char *s2);


#line 712 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizeram_t strspnrampgm (auto const char *s1, auto const far  rom char *s2);


#line 720 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strstrpgm (auto const far  rom char *s1, auto const far  rom char *s2);


#line 729 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strstrpgmram (auto const far  rom char *s1, auto const char *s2);


#line 737 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strstrrampgm (auto const char *s1, auto const far  rom char *s2);


#line 745 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strtokpgm (auto far  rom char *s1, auto const far  rom char *s2);


#line 754 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
char *strtokpgmram (auto char *s1, auto const far  rom char *s2);


#line 762 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strtokrampgm (auto far  rom char *s1, auto const char *s2);


#line 771 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom void *memsetpgm (auto far  rom void *s, auto unsigned char c, auto sizerom_t n);


#line 778 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *struprpgm (auto far  rom char *s);


#line 785 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
far  rom char *strlwrpgm (auto far  rom char *s);


#line 792 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
 
sizerom_t strlenpgm (auto const far  rom char *s);

#line 796 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"

#line 798 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"

#line 805 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
#line 814 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"

#line 816 "C:/Program Files (x86)/Microchip/mplabc18/v3.45/bin//..//h/string.h"
#line 38 "source/user_solutions.c"


#line 1 "source/delay.h"

#line 3 "source/delay.h"

#line 14 "source/delay.h"
 
typedef unsigned char u8;
typedef unsigned int u16;
typedef unsigned long u32;

void delay_ms(u32 ms)
{
    u32 i;

    while (ms--)
#line 27 "source/delay.h"
   for (i=0; i < 854   ; i++); 
#line 29 "source/delay.h"
}

void delay_us(u16 us)
{

#line 37 "source/delay.h"
    while (--us);
#line 39 "source/delay.h"
}
#line 41 "source/delay.h"
#line 40 "source/user_solutions.c"


#line 43 "source/user_solutions.c"

 
#pragma udata
byte old_sw2,old_sw3;

char input_buffer[64 ];
char output_buffer[64 ];

rom char welcome[]={"PIC18F2550 Full-Speed USB - CDC RS-232 Emulation Demo\r\n\r\n"};
rom char ansi_clrscr[]={"\x1b[2J"};         

 
void InitializeUSART(void);
void BlinkUSBStatus(void);
BOOL Switch2IsPressed(void);

void Exercise_Example(void);

void Exercise_01(void);
void Exercise_02(void);
void Exercise_03(void);
void Exercise_04(void);
void Exercise_05(void);
void EchoDemo(void);
void MenuDemo(void);
void TempHum(void);

 
#pragma code
void UserInit(void)
{
    LATB=0xFF; TRISB=0x0F; ;
    
    DHT22init();

}


#line 95 "source/user_solutions.c"
 
void ProcessIO(void)
{   
 byte len;
 
    BlinkUSBStatus();
    
    if((usb_device_state < 6 )||(UCONbits.SUSPND==1)) return;

     Exercise_Example();

}

void Exercise_Example(void)
{
    byte len;
    static byte start_up_state = 0;
    
    if(start_up_state == 0)
    {

        len=getsUSBUSART(input_buffer, 64 ); 
        if(len>0)
            start_up_state++;
    }
    else if(start_up_state == 1)
    {
        if((cdc_trf_state == 0 ) )
        {
            putrsUSBUSART(ansi_clrscr);
            start_up_state++;
        }
    }
    else if(start_up_state == 2)
    {
        if((cdc_trf_state == 0 ) )
        {
            putrsUSBUSART("\rMicrochip Technology Inc., 2004\r\n");
            start_up_state++;
        }
    }
    else if(start_up_state == 3)
    {
        if((cdc_trf_state == 0 ) )
        {
            putrsUSBUSART(welcome);
            start_up_state++;
        }
    }
    else if(start_up_state == 4)
    {







      TempHum();
    }

    
}

void Exercise_01(void)
{
    
#line 175 "source/user_solutions.c"
 
     
     
	if(Switch2IsPressed()){
    	if((cdc_trf_state == 0 ) )
			putrsUSBUSART("\rButton 2 pressed\r\n");
	}
     
    
}

rom char ex02_string[]={"Type in a string here.\r\n"};
void Exercise_02(void)
{
    
#line 205 "source/user_solutions.c"
 

     
	if(Switch2IsPressed())
	{
        if((cdc_trf_state == 0 ) )
        {
            putrsUSBUSART(ex02_string);
        }
	}
     
    
}

void Exercise_03(void)
{
	unsigned char len;

    
#line 232 "source/user_solutions.c"
 

     


  len=getsUSBUSART(input_buffer, 64 ); 
   if(len>0)
    {
    if(input_buffer[0]==0x31)
			{ LATBbits.LATB7  = !LATBbits.LATB7 ; ;
    		  if((cdc_trf_state == 0 ) )
				 putrsUSBUSART(" data 1 received\r\n");
 			}   
    if(input_buffer[0]==0x32)
			{ LATAbits.LATA4  = !LATAbits.LATA4 ; ;
    		  if((cdc_trf_state == 0 ) )
				 putrsUSBUSART(" data 2 received\r\n");
 			}   
    if(input_buffer[0]==0x33)
			{ LATAbits.LATA3  = !LATAbits.LATA3 ; ;
    		  if((cdc_trf_state == 0 ) )
				 putrsUSBUSART(" data 3 received\r\n");
 			}   
	
    }



#line 273 "source/user_solutions.c"
 
    
    
}

void Exercise_04(void)
{
    
#line 298 "source/user_solutions.c"
 
    
	if(Switch2IsPressed())
	{
	if((cdc_trf_state == 0 ) )
		{
		output_buffer[0]=0x30;
		output_buffer[1]=0x31;
		output_buffer[2]=0x32;
		output_buffer[3]=0x33;
		{ pCDCSrc.bRam = (byte*)output_buffer; cdc_tx_len = 4; cdc_mem_type = 0 ; cdc_trf_state = 1 ; } ;
		}
	}
     

     
	
}

 
void Exercise_05(void)
{
    
#line 350 "source/user_solutions.c"
 
    
    static word ex05_count;
    char tempString[10];
    if(ex05_count == 0)
    {


                                            

        

        if((cdc_trf_state == 0 ) )
        {

        }

            ex05_count = 10000;

        
    }
    else
        ex05_count--;

}





void EchoDemo(void)
{
   byte len;

   len=getsUSBUSART(input_buffer, 64 ); 
   if(len>0)
    {
	
	 LATBbits.LATB7  = !LATBbits.LATB7 ; ;
     if((cdc_trf_state == 0 ) )
      {
       { pCDCSrc.bRam = (byte *)input_buffer; cdc_tx_len = len; cdc_mem_type = 0 ; cdc_trf_state = 1 ; } ;
      }
    }
}



void MenuDemo(void)
{
   byte len;

   len=getsUSBUSART(input_buffer, 64 ); 

   if(len>0)
   {
    switch(input_buffer[0])
    {
        case '0':
            sprintf(output_buffer,"call routine for 0 \r\n");
            break;
        case '1':
            sprintf(output_buffer,"call routine for 1 \r\n");
            break;
        case 'A':
            sprintf(output_buffer,"call routine for A \r\n");
            break;
        case 'a':
            sprintf(output_buffer,"call routine for A \r\n");
            break;
        case 0x1b:
            sprintf(output_buffer,"pressed escape, call routine for ESC\r\n");
            break;
        default:
            sprintf(output_buffer,"no routine for this case \r\n");
            break;
    }
    if((cdc_trf_state == 0 ) )	{ pCDCSrc.bRam = (byte*)output_buffer; cdc_tx_len = strlen(output_buffer); cdc_mem_type = 0 ; cdc_trf_state = 1 ; } ;
   }
}

#line 433 "source/user_solutions.c"
 

void TempHum(void)
{
    static unsigned int delay=10000;
    char errorcode;
    word temp,hum;
    char outbuffer[40];

    if(delay--==0)
    {

#line 449 "source/user_solutions.c"
 

        if(status==DATAOK){
        sprintf(outbuffer,"T:%u.%u H:%u.%u\r\n",temperature.w/10,temperature.w%10,humidity.w/10,humidity.w%10);
        if((cdc_trf_state == 0 ) )  putsUSBUSART(outbuffer);
        }
    delay=10000;
    DHT22convert();
    }

}

#line 468 "source/user_solutions.c"
 
void BlinkUSBStatus(void)
{
    static word led_count=0;
    
    if(led_count == 0)led_count = 10000U;
    led_count--;

#line 477 "source/user_solutions.c"
#line 478 "source/user_solutions.c"
#line 479 "source/user_solutions.c"
#line 480 "source/user_solutions.c"

    if(UCONbits.SUSPND == 1)
    {
        if(led_count==0)
        {
            LATBbits.LATB6  = !LATBbits.LATB6 ; ;
     
        }
    }
    else
    {
        if(usb_device_state == 0 )
        {
            {LATBbits.LATB6  = 1; ;LATBbits.LATB7  = 1; ;} ;
        }
        else if(usb_device_state == 1 )
        {
            {LATBbits.LATB6  = 0; ;LATBbits.LATB7  = 0; ;} ;
        }
        else if(usb_device_state == 2 )
        {
            {LATBbits.LATB6  = 0; ;LATBbits.LATB7  = 1; ;} ;
        }
        else if(usb_device_state == 3 )
        {
            {LATBbits.LATB6  = 1; ;LATBbits.LATB7  = 0; ;} ;
        }
        else if(usb_device_state == 5 )
        {
            if(led_count == 0)
            {
                LATBbits.LATB6  = !LATBbits.LATB6 ; ;

            }
        }
        else if(usb_device_state == 6 )
        {
            if(led_count==0)
            {
                LATBbits.LATB6  = !LATBbits.LATB6 ; ;

            }
        }
    }

}

BOOL Switch2IsPressed(void)
{
    byte tmp;
    TRISBbits.TRISB6=1;
    tmp=PORTBbits.RB6 ;
    TRISBbits.TRISB6=0;
    if(tmp != old_sw2)
    {
        old_sw2 = tmp;                  
        if(tmp == 0)                    
            return TRUE;                
    }
    return FALSE;                       
}


BOOL Switch3IsPressed(void)
{
    byte tmp;
	TRISBbits.TRISB7=1;
        tmp=PORTBbits.RB7 ;
	TRISBbits.TRISB7=0;
    if(tmp != old_sw3)
    {
        old_sw3 = tmp;                  
        if(tmp == 0)                    
            return TRUE;                
    }
    return FALSE;                       
}
 
